<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>数组</title>
</head>
<body>
	<script>
		//最大值
		var arr=[30,40,39,89,77,68,9,12,35,84];
		var i,max=arr[0];
		for(i=0;i<arr.length;i++){
			if(max<arr[i]){
				max=arr[i];
			}
		}
		document.write(max);
		document.write('<br>');
		//一维数组排序
		var arr1=[30,40,39,88,22,76,32,78,45,64];
		var i,temp;
		for(i=0;i<arr1.length;i++){
			for(var j=i+1;j<arr1.length;j++){
				if(arr1[i]<arr1[j]){
					temp=arr1[i];
					arr1[i]=arr1[j];
					arr1[j]=temp;
				}
			}
		}
		console.log(arr1);
		//去空
		var arr=[30,40,,88,,76,,78,45,64];
		var newarr=[];
		for(var i=0;i<arr.length;i++){
			if(arr[i]!=undefined){
				newarr[newarr.length]=arr[i];
			}
		}
		console.log(newarr);
	   //二维数组求最大值
	   var arr=[
	          [45,78,90],
	          [36,98,23],
	          [16,89,36]
	   ]
	   var i,j,max=arr[0][0];
	   for(i=0;i<arr.length;i++){
	   	for(j=0;j<arr[i].length;j++){
	   		if(arr[i][j]>max){
	   			max=arr[i][j];
	   		}
	   	}
	   }
	   document.write(max);
	</script>
</body>
</html>